<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>My JSP 'add_user_do.jsp' starting page</title>
    
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
   <%request.setCharacterEncoding("utf-8"); %>
  <jsp:useBean id="data" class="start.fly.test.database.databaseTool" scope="page" />
 <jsp:useBean id="personNumber" class="start.fly.test.bean.PersonNumber" scope="page" >
 <jsp:setProperty property="*" name="personNumber"/>
 </jsp:useBean>
 <%
   String username=personNumber.getUsername();
   String pwd=personNumber.getPwd();
   String pwd1=personNumber.getPwd1();
   String question=personNumber.getQuestion();
   String answer=personNumber.getAnswer();
   String safecode=personNumber.getSafecode();
   String safecode1=personNumber.getSafecode1();
   String img=personNumber.getImg();
   String email=personNumber.getEmail();
   String group="企业会员";
   if(pwd.equals(pwd1)){
	   if(safecode.equals(safecode1)){
		   boolean isInsertToMen=data.insertInfoToComMenTable(username);
		   boolean isInsert=data.insertToUserNumber(username,pwd,question,answer,safecode,img,email,group);
	       if(isInsert&&isInsertToMen){
	    	   out.print("<script>alert('增加企业会员成功');document.location='companyMemberManage.jsp'</script>");  
	       }else{
	    	   out.print("<script>alert('增加企业会员失败');document.location='companyMemberManage.jsp'</script>");  
	       }
	   }else{
		   out.print("<script>alert('两次输入的安全码不一致');document.location='companyMemberManage.jsp'</script>"); 
	   }
   }else{
	   out.print("<script>alert('两次输入的密码不一致');document.location='companyMemberManage.jsp'</script>");
   }
 %>
  </body>
</html>

